package com.school.service.Impl;

import com.school.entity.Users;
import com.school.mapper.UsersMapper;
import com.school.service.UsersService;
import com.school.util.PageQueryUtil;
import com.school.util.PageResult;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName: UsersServiceImpl
 * Package: com.school.service.impl
 * Description:
 *
 * @Author laohe
 * @Create 2025-07-14 15:24
 * @Version 1.0
 */
@Service
public class UsersServiceImpl implements UsersService {

    @Resource
    private UsersMapper usersMapper;

    @Override
    public PageResult getUsersPage(PageQueryUtil pageQueryUtil) {
        int totalCount = usersMapper.getTotalUsersCount(pageQueryUtil);
        List<Users> list = usersMapper.findUsersList(pageQueryUtil);
        PageResult pageResult = new PageResult(list, totalCount, pageQueryUtil.getLimit(), pageQueryUtil.getPage());
        return pageResult;
    }
}

